/*
 * @Description: file content
 * @Author: oooh
 * @Date: 2024-08-02 10:28:13
 * @LastEditors: oooh
 * @LastEditTime: 2024-08-02 10:39:52
 * @FilePath: \Civil_Servant_Performance_PC\src\utils\parse.js
 */
/**
 * 数值保留小数位格式化
 * @param {Number | String} num 数值
 * @param {Number} [n=0] 保留n位小数
 *  */
export function numberParse(num, n = 0) {
  let data = parseFloat(num)
  if (isNaN(data)) return ''
  if (Number.isInteger(num)) {
    return num
  } else {
    return parseFloat(num.toFixed(n))
  }
}
